import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:ls_work/res/gaps.dart';
import 'package:ls_work/viewmodel/service_order/service_item_content_view_model.dart';

class ServiceItemContentPage extends BaseStatefulMvvmWidget{
  final String typeId;

  ServiceItemContentPage(this.typeId);

  @override
  State<StatefulWidget> createState() =>_ServiceItemContentState();

}

class _ServiceItemContentState extends BaseMvvmListState<ServiceItemContentViewModel,ServiceItemContentPage>{
  @override
  Widget buildRootView(BuildContext context, Widget loadingContentWidget) {
    return Scaffold(
      appBar: AppBar(title: Text('选择服务内容'),),
      body: loadingContentWidget,
    );
  }

  @override
  Widget createItemWidget(int index) {
    var item = viewModel.listItems[index];
    return IconTitleTextWidget(item.name??"").onTap(() {
      finish(result: item);
    });
  }

  @override
  bool get canPullUp => true;

  @override
  Widget get separatorDivider => Gaps.dividerLine;

  @override
  ServiceItemContentViewModel createViewModel() {
    return ServiceItemContentViewModel(context,widget.typeId);
  }

}